package ${t_package}.repository.specifications;

import com.framework.core.util.LikePatternUtil;
import com.framework.core.util.StringUtil;
import ${t_package}.domain.${t_bean};
import org.springframework.data.jpa.domain.Specification;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;

/**
* @Title: Specs
* @Description: ${ftl_description}
* @author ${ftl_auth}
* @date ${ftl_create_time}
* @version V1.0
*
*/
public class ${t_bean}Specs {

/**
* 分页查询
*
* @param  ${t_bean?uncap_first}
* @return
*/
public static Specification<${t_bean}> pageQuery${t_bean}(
final ${t_bean}  ${t_bean?uncap_first}) {

return new Specification<${t_bean}>() {
@Override
public Predicate toPredicate(Root<${t_bean}> root,
CriteriaQuery<?> query, CriteriaBuilder builder) {
    Predicate predicate = builder.and();
    // equal codeCategory
/*
    if (StringUtil.isNotEmpty( ${t_bean?uncap_first}.get${t_bean}Type())) {
        predicate = builder.and(predicate, builder.like(
        builder.lower(root.<String>get(" ${t_bean?uncap_first}Type")),
        LikePatternUtil.getLikePattern( ${t_bean?uncap_first}.get${t_bean}Type())));
    }
  */
        return predicate;
        }
    };
    }


    }
